<template>
  <div>
<!--  <el-row :gutter="40" class="panel-group" style="margin-bottom: 100px;">-->
  <el-row :gutter="40" class="panel-group">
    <el-col :xs="24" :sm="24"  class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-shopping">
          <svg-icon icon-class="table" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            {{tyZt}}
          </div>
          <CountTo :start-val="0" :end-val="tyZtCount" :duration="3000" class="card-panel-num" />
        </div>
      </div>
    </el-col>
  </el-row>
<!--  <el-row :gutter="40" class="panel-group" style="margin-bottom: 100px;">-->
  <el-row :gutter="40" class="panel-group">
    <el-col :xs="24" :sm="24"  class="card-panel-col">
      <div class="card-panel">
        <div class="card-panel-icon-wrapper icon-money">
          <svg-icon icon-class="tab" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text">
            {{bfZt}}
          </div>
          <CountTo :start-val="0" :end-val="bfZtCount" :duration="3000" class="card-panel-num" />
        </div>
      </div>
    </el-col>
  </el-row>
    <el-row :gutter="40" class="panel-group">
      <el-col :xs="24" :sm="24"  class="card-panel-col">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="table" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text">
              {{zcSyZt}}
            </div>
            <CountTo :start-val="0" :end-val="zcSyCount" :duration="3000" class="card-panel-num" />
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {selectSbZtCount} from "@/api/sbgl/sbxxgl";
import CountTo from 'vue-count-to'
export default {
  name: "SbZtTj", //设备状态统计
  components: {
    CountTo
  },
  created() {
    this.getList();
  },
  data() {
    return {
      tyZt: null, //停用状态
      tyZtCount: null, //停用状态的数量
      bfZt: null, //报废状态
      bfZtCount: null, //报废状态的数量
      zcSyZt: null, //正常使用状态
      zcSyCount: null, //正常使用的数量
    }
  },
  methods: {
    getList() {
      selectSbZtCount().then(res => {
        console.log(res.data, '设备状态统计数')
        this.tyZt = res.data[0].sbZt
        this.tyZtCount = res.data[0].count
        this.bfZt = res.data[1].sbZt
        this.bfZtCount = res.data[1].count
        this.zcSyZt = res.data[2].sbZt
        this.zcSyCount = res.data[2].count
      })
    },

  }
}
</script>

<style scoped>
.home-wrapper

.li {
  float: left;
  width: 25%;
  font-size: 12px;
  color: rgb(185, 181, 189);
}

.da {
  float: left;
  width: 25%;
  font-size: 20px;
}

.first {
  float: left;
  margin-bottom: 20px;
}

.el-table .warning-row {
  background: rgb(39, 138, 230);
}
.panel-group {
  margin-top: 18px;

  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);

    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }

      .icon-people {
        background: #40c9c6;
      }

      .icon-message {
        background: #36a3f7;
      }

      .icon-money {
        background: #f4516c;
      }
    }

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      font-weight: bold;
      display: flex;
      flex-direction: column;
      margin: 26px;
      margin-left: 0px;
      align-items: center; /* 垂直居中 */
      justify-content: center; /* 水平居中 */
      text-align: center; /* 文本内容居中 */


      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width:550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
</style>
